package com.employee.service.impl;

import com.employee.context.BaseContext;
import com.employee.mapper.DeptMapper;
import com.employee.pojo.dto.DeptDTO;
import com.employee.pojo.dto.DeptUpdateDTO;
import com.employee.pojo.entry.Dept;
import com.employee.pojo.entry.DeptHistory;
import com.employee.pojo.vo.DeptEmpVO;
import com.employee.pojo.vo.DeptInfoVO;
import com.employee.pojo.vo.DeptVO;
import com.employee.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {

    @Autowired
    private DeptMapper deptMapper;

    @Override
    public List<DeptHistory> getDeptList(Long id) {

        return deptMapper.getDeptList(id);
    }



    //查询部门
    @Override
    public List<DeptVO> getDeptListInfo() {
        List<DeptVO> dept= deptMapper.getDeptListInfo();
        System.out.println(dept);
        return dept;
    }

    @Override
    public DeptInfoVO selectDeptInfo(Integer id) {
        return deptMapper.selectDeptInfo(id);
    }

    @Override
    public List<DeptEmpVO> getDeptEmp(Integer id) {
        return deptMapper.getDeptEmp(id);
    }

    @Override
    public void addDept(DeptDTO deptDTO) {

           deptMapper.addDept(deptDTO);

    }

    @Override
    public List<DeptVO> selectByNameAndStatus(String deptName, String status) {
    return deptMapper.selectByNameAndStatus(deptName,status);
    }

    @Override
    public void updateDept(DeptUpdateDTO updateDept) {
        deptMapper.updateDept(updateDept);
    }

    @Override
    public void updateStatus(Integer id, String status) {
        deptMapper.updateStatus(id,status);
    }
}
